Ruby On Rails Interview Questions and Answers
Ques 41. WHAT PLUGIN WOULD YOU RECOMMEND FOR USER AUTHENTICATION AND AUTHORIZATION?
Devise works great with Rails.
It supports OAuth authentication and therefore integrates nicely with Facebook.
Ques 42. WHAT PLUGIN DO YOU USE FOR FULL-TEXT SEARCH in Ruby on Rails?
Sunspot supports full-text search capability and uses Solr as the back-end search engine to do so.
You would include these two plugins in your gem file as shown below:
gem 'sunspot_rails' gem 'sunspot_solr'
Ques 43. WHAT IS THE DIFFERENCE BETWEEN A PLUGIN AND A GEM in Ruby on Rails?
A gem is just ruby code. It is installed on a machine and it’s available for all ruby applications running on that machine.
Rails, rake, json, rspec — are all examples of gems.
Plugin is also ruby code but it is installed in the application folder and only available for that specific application.
Sitemap-generator, etc.
In general, since Rails works well with gems you will find that you would be mostly integrating with gem files and not plugins in general. Most developers release their libraries as gems.
Ques 44. HOW CAN YOU IMPLEMENT A SEARCH FEATURE THAT SEARCHES FOR MULTIPLE MODELS in Ruby on Rails?
If you are using acts_as_solr for your search you will be able to use multi_solr_search to enable search across multiple models.
Also, you can configure Sunspot/Solr to support search across multiple models.
Sphinx, another powerful search server can be used to search across multiple models and it works great.
Ques 45. HOW CAN YOU UPLOAD A FILE TO A SERVER in Ruby on Rails?
Paperclip is the best solution to manage file uploads to a server.
It can also help you with multiple file uploads and associate it with ActiveRecord.
There are also good examples online that show how you can make rotating sliders with the paperclip images.
Another nice solution is using carrier_wave gem.
The nice thing about carrier_wave is that it has good documentation on how to integrate with S3, Google & Rackspace for file storage.
You can achieve the same file storage capability with Paperclip as well though.
Most helpful rated by users:
- What is Ruby On Rails?
- Why Ruby on Rails?
- Explain how (almost) everything is an object in Ruby.
- What are Gems and which are some of your favorites?
- How would you declare and use a constructor in Ruby?